const { Clutter, GObject, St } = imports.gi;
const Dash = imports.ui.dash;
+const Overview = imports.ui.overview;
const ViewSelector = imports.ui.viewSelector;
+var SIDE_CONTROLS_ANIMATION_TIME = Overview.ANIMATION_TIME;
+
var ControlsState = {
HIDDEN: 0,
WINDOW_PICKER: 1,
this._updateAdjustment.bind(this));
this.viewSelector = new ViewSelector.ViewSelector(this._searchEntry,
- this._workspaceAdjustment, this.dash.showAppsButton);
+ this._workspaceAdjustment,
+ this.dash.showAppsButton,
+ this._stateAdjustment);
this.add_child(searchEntryBin);
this.add_child(this.dash);
this.layout_manager = new ControlsManagerLayout(searchEntryBin,
this.viewSelector, this.dash, this._stateAdjustment);
+ this.dash.showAppsButton.connect('notify::checked',
+ this._onShowAppsButtonToggled.bind(this));
+
this.connect('destroy', this._onDestroy.bind(this));
}
+ _onShowAppsButtonToggled() {
+ const checked = this.dash.showAppsButton.checked;
+
+ const value = checked
+ ? ControlsState.APP_GRID : ControlsState.WINDOW_PICKER;
+ this._stateAdjustment.remove_transition('value');
+ this._stateAdjustment.ease(value, {
+ duration: SIDE_CONTROLS_ANIMATION_TIME,
+ mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+ });
+ }
+
_onDestroy() {
global.workspace_manager.disconnect(this._nWorkspacesNotifyId);
}
var ActivitiesContainer = GObject.registerClass(
class ActivitiesContainer extends St.Widget {
- _init(thumbnailsBox, workspacesDisplay, appDisplay, showAppsButton) {
+ _init(thumbnailsBox, workspacesDisplay, appDisplay, overviewAdjustment) {
super._init();
// 0 for window picker, 1 for app grid
this.queue_relayout();
});
- this._showAppsButton = showAppsButton;
- showAppsButton.connect('notify::checked',
- this._onShowAppsButtonToggled.bind(this));
+ overviewAdjustment.connect('notify::value', () => {
+ this._adjustment.value = Math.max(overviewAdjustment.value - 1, 0);
+ });
this._thumbnailsBox = thumbnailsBox;
this.add_child(thumbnailsBox);
this._update();
}
- _onShowAppsButtonToggled() {
- const checked = this._showAppsButton.checked;
-
- const value = checked ? 1 : 0;
- this._adjustment.ease(value, {
- duration: OverviewControls.SIDE_CONTROLS_ANIMATION_TIME,
- mode: Clutter.AnimationMode.EASE_OUT_QUAD,
- });
- }
-
_update() {
const progress = this._adjustment.value;
'page-empty': {},
},
}, class ViewSelector extends Shell.Stack {
- _init(searchEntry, workspaceAdjustment, showAppsButton) {
+ _init(searchEntry, workspaceAdjustment, showAppsButton, overviewAdjustment) {
super._init({
name: 'viewSelector',
x_expand: true,
this._thumbnailsBox,
this._workspacesDisplay,
this.appDisplay,
- showAppsButton);
+ overviewAdjustment);
this._activitiesPage =
this._addPage(activitiesContainer, _('Activities'), 'view-app-grid-symbolic');